<#--<%@page language="java" import="java.util.*" pageEncoding="utf-8"%>-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml/DTD/xhtml1-transitional.dtd">

<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>ShoppingDemo</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />


    <link href="<@spring.url 'static/css/bootstrap.min.css'></@spring.url>" rel="stylesheet" />
    <link rel="stylesheet" href="<@spring.url 'static/css/font-awesome.min.css'></@spring.url>" />

    <!--[if IE 7]>
	<link rel="stylesheet" href="<@spring.url 'static/css/font-awesome-ie7.min.css'></@spring.url>" />
    <![endif]-->

    <!-- page specific plugin styles -->

    <!-- fonts -->

    <link rel="stylesheet" href="<@spring.url 'static/css/cyrillic.css'></@spring.url>" />

    <!-- ace styles -->

    <link rel="stylesheet" href="<@spring.url 'static/css/ace.min.css'></@spring.url>" />
    <link rel="stylesheet" href="<@spring.url 'static/css/ace-rtl.min.css'></@spring.url>" />
    <link rel="stylesheet" href="<@spring.url 'static/css/ace-skins.min.css'></@spring.url>" />

    <!--[if lte IE 8]>
	<link rel="stylesheet" href="<@spring.url 'static/css/ace-ie.min.css'></@spring.url>" />
    <![endif]-->

    <!-- inline styles related to this page -->

    <!-- ace settings handler -->

    <script src="<@spring.url 'static/js/ace-extra.min.js'></@spring.url>"></script>

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

    <!--[if lt IE 9]>
	<script src="<@spring.url 'static/js/html5shiv.js'></@spring.url>"></script>
	<script src="<@spring.url 'static/js/respond.min.js'></@spring.url>"></script>
    <![endif]-->
</head>

<body>
<div class="navbar navbar-default" id="navbar">
    <script type="text/javascript">
        try{ace.settings.check('navbar' , 'fixed')}catch(e){}
    </script>

    <div class="navbar-container" id="navbar-container">
        <div class="navbar-header pull-left">
            <a href="#" class="navbar-brand">
                <small>
                    <i class="icon-leaf"></i>
                    Shopping Demo Admin
                </small>
            </a><!-- /.brand -->
        </div><!-- /.navbar-header -->

        <div class="navbar-header pull-right" role="navigation">
            <ul class="nav ace-nav">
                <li class="light-blue">
                    <a data-toggle="dropdown" href="#" class="dropdown-toggle">
                        <img class="nav-user-photo" src="<@spring.url 'static/avatars/user.jpg'></@spring.url>" alt="Jason's Photo" />
									<span class="user-info">
										<small>Welcome,</small>
										<#if user_info??>
										    <p>${user_info.getUsername()}</p>
										</#if>
									</span>

                        <i class="icon-caret-down"></i>
                    </a>

                    <ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
                        <li>
                            <a href="#">
                                <i class="icon-cog"></i>
                                Settings
                            </a>
                        </li>

                        <li>
                            <a href="#">
                                <i class="icon-user"></i>
                                Profile
                            </a>
                        </li>

                        <li class="divider"></li>

                        <li>
                            <a href="#">
                                <i class="icon-off"></i>
                                Logout
                            </a>
                        </li>
                    </ul>
                </li>
            </ul><!-- /.ace-nav -->
        </div><!-- /.navbar-header -->
    </div><!-- /.container -->
</div>

<div class="main-container" id="main-container">
    <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
    </script>

    <div class="main-container-inner">
        <a class="menu-toggler" id="menu-toggler" href="#">
            <span class="menu-text"></span>
        </a>

        <div class="sidebar" id="sidebar">
            <script type="text/javascript">
                try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
            </script>

            <div class="sidebar-shortcuts" id="sidebar-shortcuts">
                <div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
                    <button class="btn btn-success">
                        <i class="icon-signal"></i>
                    </button>

                    <button class="btn btn-info">
                        <i class="icon-pencil"></i>
                    </button>

                    <button class="btn btn-warning">
                        <i class="icon-group"></i>
                    </button>

                    <button class="btn btn-danger">
                        <i class="icon-cogs"></i>
                    </button>
                </div>

                <div class="sidebar-shortcuts-mini" id="sidebar-shortcuts-mini">
                    <span class="btn btn-success"></span>

                    <span class="btn btn-info"></span>

                    <span class="btn btn-warning"></span>

                    <span class="btn btn-danger"></span>
                </div>
            </div><!-- #sidebar-shortcuts -->

            <ul class="nav nav-list">
                <li class="active">
                    <a href="<@spring.url 'index.html'></@spring.url>">
                        <span class="menu-text"> Dashboard </span>
                    </a>
                </li>
                <li>
                    <a href="#" class="dropdown-toggle">
                        <span class="menu-text"> 查看用户 </span>
                        <b class="arrow icon-angle-down"></b>
                    </a>
                    <ul class="submenu">
                        <li>
                            <a href="<@spring.url 'user.html'></@spring.url>">
                                用户信息
                            </a>
                        </li>
                        <li>
                            <a href="<@spring.url 'addUser.html'></@spring.url>">
                                添加用户
                            </a>
                        </li>
                        <li>
                            <a href="<@spring.url 'updateUser.html'></@spring.url>">
                                修改用户信息
                            </a>
                        </li>
                    </ul>

                </li>

                <li>
                    <a href="#" class="dropdown-toggle">
                        <span class="menu-text"> 查看商品 </span>
                        <b class="arrow icon-angle-down"></b>
                    </a>
                    <ul class="submenu">
                        <li>
                            <a href="<@spring.url 'product.html'></@spring.url>">
                                商品详细信息
                            </a>
                        </li>
                        <li>
                            <a href="<@spring.url 'addProduct.html'></@spring.url>">
                                添加商品
                            </a>
                        </li>
                        <li>
                            <a href="<@spring.url 'updateProduct.html'></@spring.url>">
                                修改商品信息
                            </a>
                        </li>
                    </ul>
                </li>

                <li>
                    <a href="#" class="dropdown-toggle">
								<span class="menu-text">
									查看商品类别
								</span>
                        <b class="arrow icon-angle-down"></b>
                    </a>
                    <ul class="submenu">
                        <li>
                            <a href="<@spring.url 'category.html'></@spring.url>">
                                商品类别信息
                            </a>
                        </li>
                        <li>
                            <a href="<@spring.url 'addCategory.html'></@spring.url>">
                                添加商品类别
                            </a>
                        </li>
                    </ul>
                </li>

                <li>
                    <a href="#" class="dropdown-toggle">
                        <span class="menu-text"> 查看订单 </span>
                        <b class="arrow icon-angle-down"></b>
                    </a>
                    <ul class="submenu">
                        <li>
                            <a href="<@spring.url 'order.html'></@spring.url>">
                                订单信息
                            </a>
                        </li>
                        <li>
                            <a href="<@spring.url 'updateOrder.html'></@spring.url>">修改订单状态</a>
                        </li>
                    </ul>
                </li>
            </ul><!-- /.nav-list -->

            <script type="text/javascript">
                try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
            </script>
        </div>

        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <script type="text/javascript">
                    try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
                </script>

                <ul class="breadcrumb">
                    <li>
                        <i class="icon-home home-icon"></i>
                        <a href="#">Home</a>
                    </li>
                </ul><!-- .breadcrumb -->
            </div>

            <div class="page-content">
                <div class="page-header">
                    <h1>
                        修改订单状态
                    </h1>
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <form class="form-horizontal" role="form" action="<@spring.url 'doUpdateOrder.html'></@spring.url>" method="post"
                              modelAttribute="order">
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-l">
                                    OrderId
                                </label>
                                <div class="col-sm-9">
                                    <div class="col-xs-10 col-sm-5" style="padding-left:0;padding-right: 0;">
                                        <select class="form-control" id="form-field-1" name="orderId" onchange="OrderIdChanged(this)">
                                            <#list orderList as order>
                                                <option value="${order.getOrderId()}">${order.getOrderId()}</option>
                                            </#list>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                                    Custom Name
                                </label>
                                <div class="col-sm-9">
                                    <p class="col-xs-10 col-sm-5" id="customName-p" style="padding-left: 0; padding-right: 0;">
                                        ${orderList[0].getCustomName()}
                                    </p>
                                    <input type="hidden" id="customName-field" value="${orderList[0].getCustomName()}" name="customName">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                                    Time
                                </label>
                                <div class="col-sm-9">
                                    <p class="col-xs-10 col-sm-5" id="time-p" style="padding-left: 0; padding-right: 0;">
                                        ${orderList[0].getTime()}
                                    </p>
                                    <input type="hidden" value="${orderList[0].getTime()}" id="time-field" name="time">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                                    Address
                                </label>
                                <div class="col-sm-9">
                                    <p class="col-xs-10 col-sm-5" style="padding-left: 0; padding-right: 0;" id="address-p">
                                        ${orderList[0].getAddress()}
                                    </p>
                                    <input type="hidden" value="${orderList[0].getAddress()}" id="address-field" name="address">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                                    Total
                                </label>
                                <div class="col-sm-9">
                                    <p class="col-xs-10 col-sm-5" style="padding-left: 0; padding-right: 0;" id="totalPrice-p">
                                    ${orderList[0].getTotalPrice()}
                                    </p>
                                    <input type="hidden" value="${orderList[0].getTotalPrice()}" id="totalPrice-field" name="totalPrice">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-1">
                                    Status
                                </label>
                                <div class="col-sm-9">
                                    <div class="col-xs-10 col-sm-5" style="padding-left: 0; padding-right: 0;">
                                        <select style="width:100%" name="status" id="status-select-field">
                                            <option value="Start" <#if orderList[0].getStatus()=="Start">selected</#if>>Start</option>
                                            <option value="Finish" <#if orderList[0].getStatus()=="Finish">selected</#if>>End</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                        <#if message??>
                            <div class="form-group">
                                <p style="margin-left: 40%; margin-right: 40%; color: red;">
                                ${message}
                                </p>
                            </div>
                        </#if>

                            <div class="clearfix form-actions">
                                <div class="col-md-offset-3 col-md-9">
                                    <button class="btn btn-info" type="submit">
                                        <i class="icon-ok bigger-110"></i>
                                        Submit
                                    </button>

                                    &nbsp; &nbsp; &nbsp;
                                    <button class="btn" type="reset">
                                        <i class="icon-undo bigger-110"></i>
                                        Reset
                                    </button>
                                </div>
                            </div>
                        </form>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div><!-- /.main-content -->

        <div class="ace-settings-container" id="ace-settings-container">
            <div class="btn btn-app btn-xs btn-warning ace-settings-btn" id="ace-settings-btn">
                <i class="icon-cog bigger-150"></i>
            </div>

            <div class="ace-settings-box" id="ace-settings-box">
                <div>
                    <div class="pull-left">
                        <select id="skin-colorpicker" class="hide">
                            <option data-skin="default" value="#438EB9">#438EB9</option>
                            <option data-skin="skin-1" value="#222A2D">#222A2D</option>
                            <option data-skin="skin-2" value="#C6487E">#C6487E</option>
                            <option data-skin="skin-3" value="#D0D0D0">#D0D0D0</option>
                        </select>
                    </div>
                    <span>&nbsp; Choose Skin</span>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-navbar" />
                    <label class="lbl" for="ace-settings-navbar"> Fixed Navbar</label>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-sidebar" />
                    <label class="lbl" for="ace-settings-sidebar"> Fixed Sidebar</label>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-breadcrumbs" />
                    <label class="lbl" for="ace-settings-breadcrumbs"> Fixed Breadcrumbs</label>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-rtl" />
                    <label class="lbl" for="ace-settings-rtl"> Right To Left (rtl)</label>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-add-container" />
                    <label class="lbl" for="ace-settings-add-container">
                        Inside
                        <b>.container</b>
                    </label>
                </div>
            </div>
        </div><!-- /#ace-settings-container -->
    </div><!-- /.main-container-inner -->

    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</div><!-- /.main-container -->

<!-- basic scripts -->

<!--[if !IE]> -->

<script src="<@spring.url 'static/js/jquery-2.0.3.min.js'></@spring.url>"></script>

<!-- <![endif]-->

<!--[if IE]>
<script src="<@spring.url 'static/js/jquery-1.10.2.min.js'></@spring.url>"></script>
<![endif]-->

<!--[if !IE]> -->

<script type="text/javascript">
    window.jQuery || document.write("<script src='static/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
</script>

<!-- <![endif]-->

<!--[if IE]>
<script type="text/javascript">
	window.jQuery || document.write("<script src='static/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
</script>
<![endif]-->

<script type="text/javascript">
    if("ontouchend" in document) document.write("<script src='static/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
</script>
<script src="<@spring.url 'static/js/bootstrap.min.js'></@spring.url>"></script>
<script src="<@spring.url 'static/js/typeahead-bs2.min.js'></@spring.url>"></script>

<!-- page specific plugin scripts -->
<script type="text/javascript" src="<@spring.url 'static/js/jquery.dataTables.min.js'></@spring.url>"></script>
<script type="text/javascript" src="<@spring.url 'static/js/jquery.dataTables.bootstrap.js'></@spring.url>"></script>
<!-- ace scripts -->

<script src="<@spring.url 'static/js/ace-elements.min.js'></@spring.url>"></script>
<script src="<@spring.url 'static/js/ace.min.js'></@spring.url>"></script>

<script type="text/javascript">
    Date.prototype.Format = function (fmt) { //author: meizz
        var o = {
            "M+": this.getMonth() + 1, //月份
            "d+": this.getDate(), //日
            "H+": this.getHours(), //小时
            "m+": this.getMinutes(), //分
            "s+": this.getSeconds(), //秒
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度
            "S": this.getMilliseconds() //毫秒
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }
    function OrderIdChanged(choose) {
        var orderId = choose.value;
        var url = "http://localhost:8080/api/order?orderId=" + orderId;
        $(function() {
            $.getJSON(url, function(data){

                $("#customName-field").val(data.customName);
                $("#customName-p").text(data.customName);
                $("#address-field").val(data.address);
                $("#address-p").text(data.address);
                $("#status-select-field").val(data.status);
                $("#totalPrice-field").val(data.totalPrice);
                $("#totalPrice-p").text(data.totalPrice);
                $("#time-field").val(data.time);
                $("#time-p").text(new Date(data.time).Format("yyyy-MM-dd HH:mm:ss"));

            })
        });
    }
</script>

<!-- inline scripts related to this page -->
<script>var _hmt = _hmt || [];(function(){var hm=document.createElement("script");hm.src = "//hm.baidu.com/hm.js?a43c39da34531f4da694d4499c5614d4";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm, s);})();</script>
</body>
</html>